package com.wyf.service.impl;

import com.wyf.ao.UserAo;
import com.wyf.entity.User;
import com.wyf.mapper.UserMapper;
import com.wyf.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author wyf
 * @date 2022年07月17日 16:26
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;
    /**
     * 检查用户账号是否已经被注册
     * @param userName
     * @return
     */
    @Override
    public User checkUser(String userName) {
        return userMapper.checkUser(userName);
    }

    /**
     * 保存用户信息
     * @param user
     * @return
     */
    @Override
    public int saveUser(User user) {
        return userMapper.insert(user);
    }

    /**
     * 用户登录
     * @param userAo
     * @return
     */
    @Override
    public User login(UserAo userAo) {
        return userMapper.login(userAo.getUserName(),userAo.getPassword());
    }
}
